package com.zs4sdk.jslocalobj;

import android.webkit.JavascriptInterface;


/**
 * 支付界面的js返调类
 *
 * @author chengfu.bao
 */
public class Zs4GamePaymentInJavascriptLocalObj {
    /**
     * 返调监听
     */
    private zs4gamePaymentInJavascriptCallback mCallback;

    /**
     * 返调接口
     *
     * @author chengfu.bao
     */
    public interface zs4gamePaymentInJavascriptCallback {

        /**
         * function: 用原生支付
         *
         * @param param
         * @ author: aXiBa 2013-4-25 下午4:10:48
         */
        public void onpay(String param);

        /**
         * function: 网页支付结果
         *
         * @param pay_result
         * @ author: aXiBa 2013-5-13 下午3:12:28
         */
        public void onpaywapcomplete(String pay_result);

        //升级账号
        public void goupdateaccount();

        //继续支付
        public void revoucher();

        //f返回游戏
        public  void goto_game();

    }

    /**
     * 构造方法
     *
     * @param callback
     */
    public Zs4GamePaymentInJavascriptLocalObj(zs4gamePaymentInJavascriptCallback callback) {
        this.mCallback = callback;
    }

    @JavascriptInterface
    public void onpay(String goodsid) {
        if (this.mCallback != null) {
            this.mCallback.onpay(goodsid);
        }
    }


    @JavascriptInterface
    public void onpaywapcomplete(String pay_result) {
        if (this.mCallback != null) {
            this.mCallback.onpaywapcomplete(pay_result);
        }
    }

    @JavascriptInterface
    public void goupdateaccount() {
        if (this.mCallback != null) {
            this.mCallback.goupdateaccount();
        }
    }

    @JavascriptInterface
    public void revoucher() {
        if (this.mCallback != null) {
            this.mCallback.revoucher();
        }
    }

    @JavascriptInterface
    public void goto_game() {
        if (this.mCallback != null) {
            this.mCallback.goto_game();
        }
    }
}
